package com.wdc.deliveryrobot.activity;

import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.util.Log;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.wdc.deliveryrobot.R;
import com.wdc.deliveryrobot.event.Event;

import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;


public class LoadingActivity extends BaseActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_loading);


        ImageView loadingImage = findViewById(R.id.loading_image);


        // 使用 Glide 加载 GIF 动图
        Glide.with(this)
                .asGif()
                .load(R.drawable.loading) // 加载图片
                .into(loadingImage);

        new Handler().postDelayed(() -> {
            Intent intent = new Intent(LoadingActivity.this, DeliveryActivity.class);
            startActivity(intent);
            finish(); // 结束加载页面
        }, 3000);
//        if (!init) {
//            selfChassisState = SelfChassisState.getInstance();
//            init = true;
//        }


//        if (initd){
//
//            new Handler().postDelayed(() -> {
//                Intent intent = new Intent(LoadingActivity.this, DeliveryActivity.class);
//                startActivity(intent);
//                finish(); // 结束加载页面
//            }, 2000);
//        }else {
//            HintDialog hintDialog = new HintDialog(getBaseContext());
//            hintDialog.setMessage(getString(R.string.tcp_connect_error));
//
//            hintDialog.setCancelButtonClickListener(new View.OnClickListener() {
//                @Override
//                public void onClick(View view) {
//                    hintDialog.dismiss();
//                }
//            });
//
//            hintDialog.setOkButtonClickListener(new View.OnClickListener() {
//                @Override
//                public void onClick(View view) {
//                    finish();
//                }
//            });
//            hintDialog.show();
//        }



    }

    @Subscribe(threadMode = ThreadMode.MAIN)
    public void OnDataEvent(Event.OnDataEvent onDataEvent){

    }



}